<!DOCTYPE HTML>
<html ng-app="myApp">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>自定义过滤器(把第一个字母变成大写)</title>
    <script src="../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
    <script>
        var m1 = angular.module('myApp',[]);

        m1.filter('firstUpper',function () {
            return function (str) {
                return str.charAt(0).toUpperCase() + str.substring(1);
            }
        });

        m1.controller('Aaa',['$scope','$filter',function ($scope,$filter) {
            $scope.name = "hello";
        }]);



    </script>
</head>

<body>

<div ng-controller="Aaa">
    <p>{{name | firstUpper}}</p>
</div>

</body>
</html>
